package cn.yanxiaohui.service.web.pattern.observer;

/**
 * 观察者的实现类
 */
public class User implements Observer{

    private String name;

    private String message;

    public User(String name){
        this.name = name;
    }

    @Override
    public void receive(String message) {
        this.message = message;

        /**
         * 接收订阅后阅读订阅信息
         */
        read();
    }
    
    public void read(){
        System.out.println("用户【" + name + "】查看了信息【" + message + "】");
    }
}
